package com.zjh;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.Reader;
import java.util.Map;
import java.util.Set;

/**
 * @author LiZiQiu
 * @data 2023/3/4
 */
public class Test5 {
    public static void main(String[] args) {
        try {
            Reader reader = Resources.getResourceAsReader("mybatis-config.xml");
            SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
            SqlSessionFactory build = builder.build(reader, "a2");
            SqlSession session = build.openSession();
            Map map = session.selectOne("com.zjh.dao.StudentDao.find");
            Set<Map.Entry> set = map.entrySet();
            for (Map.Entry o : set) {
                System.out.println(o);
            }

            session.close();
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
